% Figure 7a

axoptions = {'scaled ticks = false',...
             'y tick label style={/pgf/number format/.cd, fixed, fixed zerofill, precision=0, set thousands separator={}}',...
             'x tick label style={/pgf/number format/.cd, precision=1, set thousands separator={}}',...
             'legend style={font=\normalsize}'}; %\scriptsize
 
load ../data/DataforMatlab/IP.csv;
load ../data/DataforMatlab/torn.csv;
load ../data/DataforMatlab/OuryaxisUK_base;
OuryaxisUK_base = OuryaxisUK;
OurxaxisUK_base = OurxaxisUK;
%% Percentile for plotting
run("../subroutines/sub_make_percentile.m")

save("../data/DataforMatlab/MissingPriceMM.mat","U","W");

figure('name','Figure 7','NumberTitle','off')
h = loglog(OurxaxisUK, (RC(:, end)), 'LineWidth', 2, 'Color', "#D95319"); hold on
loglog(OurxaxisUK, OuryaxisUK, 'LineWidth', 2, 'Color', "#0072BD");
loglog(OurxaxisUK_base, OuryaxisUK_base, 'LineWidth', 2);
ax = ancestor(h, 'axes');
ax.XAxis.Exponent = 0;
ax.XAxis.TickLabelFormat = '%.0f';
xlim([min(OurxaxisUK), 100000])
ylim([min(OuryaxisUK), max(OuryaxisUK)])
daspect auto
xticklabels({'10,000','100,000'})
yticklabels({'1,000','10,000'})
xlabel('Income in 2017')
ylabel('1974 Income that gives the same utility as in 2017')
legend('Real consumption', 'Money metric (unobserved prices)', 'Money metric (observed price)', 'Location', 'northwest')
%matlab2tikz('../fig/MM_comparison_OLS.tex', 'extraAxisOptions', axoptions);
 
